﻿@model IList<Shop.Wares.Models.WaresCategory>
@{
    ViewBag.Title = "欢迎来到九七电子书！！";
    Layout = "~/Views/Home/_HomeLayout.cshtml";
}

<!-- 右下侧的框框里的  -->
<section class="so-spotlight1 ">
    <div class="container">
        <div class="row">
            <div id="yt_header_right" class="col-lg-offset-3 col-lg-9 col-md-12">
                <div class="slider-container ">

                    @*<div class="module first-block">
                        <div class="modcontent clearfix">
                            <div id="custom_popular_search" class="clearfix">
                                <h5 class="so-searchbox-popular-title pull-left">热门搜索:</h5>
                                <div class="so-searchbox-keyword">
                                    <ul class="list-inline">
                                        <li>&nbsp;<a href="#">哈哈,</a></li>
                                        <li><a href="#">哈哈1,</a></li>
                                        <li><a href="#">哈哈2,</a></li>
                                        <li><a href="#">哈哈3,</a></li>
                                        <li><a href="#">哈哈4,</a></li>
                                        <li><a href="#">哈哈5,</a></li>
                                        <li><a href="#">哈哈6,</a></li>
                                        <li><a href="#">哈哈7,</a></li>
                                        <li><a href="#">哈哈8,</a></li>
                                        <li><a href="#">哈哈9</a></li>
                                    </ul>
                                </div>
                            </div>
                        </div>
                    </div>*@
                    <!--图片轮转尺寸600X422，轮播代码-->
                    <div id="so-slideshow" class="col-lg-8 col-md-8 col-sm-12 col-xs-12 two-block">
                        <div class="module slideshow no-margin">
                            @{IList<Shop.Home.Models.WaresPicture> wpinfo0 = ViewBag.wpinfo0; }
                            @foreach (var item in wpinfo0)
                            {
                                if (wpinfo0.Count == 1)
                                {
                                    <div class="item">
                                        <a href="../Home/WaresProduct-@item.WID"><img src="@item.Url" alt="@item.WName" class="img-responsive" style="width:860px;height:422px;"></a>
                                    </div>
                                }
                                <div class="item">
                                    <a href="../Home/WaresProduct-@item.WID"><img src="@item.Url" alt="@item.WName" class="img-responsive" style="width: 860px; height: 422px;"></a>
                                </div>
                            }
                        </div>
                        <div class="loadeding"></div>
                    </div>

                    @*右侧三张图片尺寸260X134 暂时注释*@
                    <div class="module col-md-4  hidden-sm hidden-xs three-block ">
                        <div class="modcontent clearfix">
                            <div class="htmlcontent-block">
                                <ul class="htmlcontent-home">
                                    @{IList<Shop.Home.Models.WaresPicture> wpinfo1 = ViewBag.wpinfo1; int num = 0;}
                                    @foreach (var item in wpinfo1)
                                    {
                                        if (num >= 3)
                                        {
                                            break;
                                        }
                                        num++;
                                        <li>
                                            <div class="banners">
                                                <div>
                                                    <a href="../Home/WaresProduct-@item.WID"><img src="@item.Url" alt="@item.WName" style="width:260px;height:134px;"></a>
                                                </div>
                                            </div>
                                        </li>
                                    }
                                </ul>
                            </div>
                        </div>
                    </div>

                    @*<div class="module hidden-xs col-sm-12 four-block">
                        <div class="modcontent clearfix">
                            <div class="policy-detail">
                                <div class="banner-policy">
                                    <div class="policy policy1"><a href="#"> <span class="ico-policy">&nbsp;</span>90天<br>退款</a></div>
                                    <div class="policy policy2"><a href="#"> <span class="ico-policy">&nbsp;</span>店内交流</a></div>
                                    <div class="policy policy3"><a href="#"> <span class="ico-policy">&nbsp;</span>价格最低</a></div>
                                    <div class="policy policy4"><a href="#"> <span class="ico-policy">&nbsp;</span>购物保证</a></div>
                                </div>
                            </div>
                        </div>
                    </div>*@
                </div>
            </div>
        </div>
    </div>
</section>

<!-- //右下侧的框框里的  -->
<!-- 导航下边底部上边那一块  -->
<div class="main-container container">
    <div class="row">
        <div id="content" class="col-sm-12">
            @foreach (var item in Model)
            {
                @Html.Action("_WaresTopCategory", "Home", new { CID = item.CID, Top = 5,CName = item.CName })
            }
        </div>
    </div>
</div>
<!-- 导航下边底部上边那一块-->

<script type="text/javascript">
    //加入购物车
    function addshopcar(WID, WName, Url)
    {
         $.ajax({
            cache: false,
            type: 'post',
            url: '@Url.Action("AddShopCar")',
            data: { WID: WID, BuyNum:1},
            dataType: 'text',
            success: function (data) {
                if (data == 'NO1') {
                    alert("库存不足");
                    return false;
                }
                if (data == 'NO')
                {
                    alert("添加失败");
                    return false;
                }
                if (data == "User")
                {
                    alert("无效的用户状态，请重新登陆");
                    location.href = "@Url.Action("UsersLogin","User")";
                    return false;
                }
                else
                {
                    cart.add(WName, Url);
                    HomeShopCar();
                }
            },
            error: function () {
                alert("Ajax调用出错请与管理员联系");
            }
        });
    }

    $(document).on('ready', function () {
        document.getElementById("alllb").click();
    });
</script>